package com.ruoyi.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.order.domain.OrderRefund;
import com.ruoyi.order.mapper.OrderRefundMapper;
import com.ruoyi.order.service.IOrderRefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单退款记录Service业务层处理
 *
 * @author HHAOYU
 * @date 2020-12-18
 */
@Service
public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, OrderRefund> implements IOrderRefundService {
    @Autowired
    private OrderRefundMapper orderRefundMapper;

    /**
     * 查询订单退款记录
     *
     * @param id 订单退款记录ID
     * @return 订单退款记录
     */
    @Override
    public OrderRefund selectOrderRefundById(Long id)
    {
        return orderRefundMapper.selectOrderRefundById(id);
    }

    /**
     * 查询订单退款记录列表
     *
     * @param orderRefund 订单退款记录
     * @return 订单退款记录
     */
    @Override
    public List<OrderRefund> selectOrderRefundList(OrderRefund orderRefund)
    {
        return orderRefundMapper.selectOrderRefundList(orderRefund);
    }

    /**
     * 新增订单退款记录
     *
     * @param orderRefund 订单退款记录
     * @return 结果
     */
    @Override
    public int insertOrderRefund(OrderRefund orderRefund)
    {
        orderRefund.setCreateTime(DateUtils.getNowDate());
        return orderRefundMapper.insertOrderRefund(orderRefund);
    }

    /**
     * 修改订单退款记录
     *
     * @param orderRefund 订单退款记录
     * @return 结果
     */
    @Override
    public int updateOrderRefund(OrderRefund orderRefund)
    {
        orderRefund.setUpdateTime(DateUtils.getNowDate());
        return orderRefundMapper.updateOrderRefund(orderRefund);
    }

    /**
     * 批量删除订单退款记录
     *
     * @param ids 需要删除的订单退款记录ID
     * @return 结果
     */
    @Override
    public int deleteOrderRefundByIds(Long[] ids)
    {
        return orderRefundMapper.deleteOrderRefundByIds(ids);
    }

    /**
     * 删除订单退款记录信息
     *
     * @param id 订单退款记录ID
     * @return 结果
     */
    @Override
    public int deleteOrderRefundById(Long id)
    {
        return orderRefundMapper.deleteOrderRefundById(id);
    }
}
